/**
 * @Date 2020-06-28 14:46:37
 * @Remark
 */

// lib
// config
// script & methods & public
// http
// service
import {
  simplePageService,
  simpleObjectService,
  simpleBooleanService,
  simpleListService,
} from "@/public/service/simple.service";
import store from "@/store";
// api
import {
  ReqDeptPage,
  ResDeptPage,
  API_DEPT_PAGE,
  ReqDeptAdd,
  API_DEPT_ADD,
  ResDeptAdd,
  API_DEPT_UPDATE,
  ReqDeptUpdate,
  ResDeptUpdate,
  API_DEPT_DEL,
  ReqDeptDel,
  ResDeptDel,
  API_DEPT_LIST_C_DEPT,
  ReqDeptLISTC,
  ResDeptLISTC,
} from "./api";
// interface && type && class
import { DeptDto } from "./model";
// 其它

// 菜单分页
export async function getDeptPageService(params: ReqDeptPage) {
  return simplePageService<ReqDeptPage, ResDeptPage, DeptDto>(API_DEPT_PAGE, params);
}
// 菜单添加
export async function addDeptService(params: ReqDeptAdd) {
  return simpleObjectService<ReqDeptAdd, ResDeptAdd, DeptDto>(API_DEPT_ADD, params);
}

// 菜单编辑
export async function updateDeptService(params: ReqDeptUpdate) {
  return simpleObjectService<ReqDeptUpdate, ResDeptUpdate, DeptDto>(API_DEPT_UPDATE, params);
}
// 获取下级
export async function getDeptListService(params: ReqDeptLISTC) {
  return simpleListService<ReqDeptLISTC, ResDeptLISTC, DeptDto>(API_DEPT_LIST_C_DEPT, params);
}

// 菜单删除
export async function delDeptService(id: number) {
  return simpleBooleanService<ReqDeptDel, ResDeptDel>(API_DEPT_DEL, {
    id,
  });
}
